import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('@/views/Login.vue')
  },
  {
    path: '/login',
    component: () => import('@/views/Login.vue')
  },
  {
    path: '/layout',
    component: () => import('@/components/Layout.vue'),
    children:[
      {
        path: '',
        component: () => import('@/views/Welcome.vue'),
        meta:{
          title: '首页'
        }
      },
      {
        path: '/welcome',
        component: () => import('@/views/Welcome.vue'),
        meta:{
          title: '首页'
        }
      },
      {
        path: '/coverage', //父层级
        meta:{
          breadcrumb: '险种管理'
        },
        children: [
          {
            path: '/coverageList',
            component: () => import('@/views/CoverageList.vue'),
            meta:{
              breadcrumb: '险种信息',
              title: '险种信息'
            }
          },
        ]
      },
      {
        path: '/insure', //父层级
        meta:{
          breadcrumb: '投保管理'
        },
        children: [
          {
            path: '/insureList',
            component: () => import('@/views/InsureList.vue'),
            meta:{
              breadcrumb: '投保信息',
              title: '投保信息'
            }
          },
          {
            path: '/insureShow',
            component: () => import('@/views/InsureShow.vue'),
            meta:{
              breadcrumb: '保单列表',
              title: '保单列表'
            }
          },
        ]
      },
      {
        path: '/claim',
        meta:{
          breadcrumb: '报案管理'
        },
        children:[
          {
            path: '/claimList',
            component: () => import('@/views/ClaimList.vue'),
            meta: {
              breadcrumb: '报案信息',
              title:'报案信息'
            },
          },
          // 报案表单页（新增/编辑/详情）
          {
            path: '/claimForm',
            name: 'ClaimReportForm',
            component: () => import('@/views/ClaimReportForm.vue'),
            meta: { title: '报案编辑', requiresAuth: true }
          }
        ],
      },
      {
        path: '/dispatch',
        meta:{
          breadcrumb: '调度管理'
        },
        children:[
          {
            path: '/dispatchList',
            component: () => import('@/views/DispatchList.vue'),
            meta: {
              breadcrumb: '调度信息',
              title:'调度信息'
            },
          },
          // 报案表单页（新增/编辑/详情）
          {
            path: '/dispatchTask',
            component: () => import('@/views/DispatchTask.vue'),
            meta: { title: '调度任务', breadcrumb: '调度任务' }
          }
        ],
      },
      {
        path: '/survey', //父层级
        meta:{
          breadcrumb: '查勘管理'
        },
        children: [
          {
            path: '/confirm',
            component: () => import('@/views/Confirm.vue'),
            meta:{
              breadcrumb: '确认页面',
              title: '确认页面'
            }
          },
          {
            path: '/surveyList',
            component: () => import('@/views/SurveyList.vue'),
            meta:{
              breadcrumb: '任务列表',
              title: '任务列表'
            }
          },
          {
            path: '/updateSurvey',
            component: () => import('@/views/UpdateSurvey.vue'),
            meta:{
              breadcrumb: '添加查勘信息',
              title: '添加查勘信息'
            }
          },
          {
            path: '/surveyInfo',
            component: () => import('@/views/surveyInfo.vue'),
            meta:{
              breadcrumb: '查勘信息',
              title: '查勘信息'
            },

          },
        ]
      },
      {
        path: '/registration', //父层级
        meta:{
          breadcrumb: '立案管理'
        },
        children: [
          {
            path: '/registrationList',
            component: () => import('@/views/RegistrationList.vue'),
            meta:{
              breadcrumb: '立案信息记录',
              title: '立案信息记录'
            }
          },
          {
            path: '/registrationAdd',
            component: () => import('@/views/RegistrationAdd.vue'),
            meta:{
              breadcrumb: '新增立案',
              title: '新增立案'
            }
          },
        ]
      },
      {
        path: '/calculation', //父层级
        meta:{
          breadcrumb: '理算管理'
        },
        children: [
          {
            path: '/calculationAdd',
            component: () => import('@/views/ClaimCalculationForm.vue'),
            meta:{
              breadcrumb: '待理算表',
              title: '待理算表'
            }
          },
          {
            path: '/calculationList',
            component: () => import('@/views/ClaimCalculationList.vue'),
            meta:{
              breadcrumb: '理算记录',
              title: '理算记录'
            }
          },
        ]
      },
      {
        path: '/assessmentApproval', //父层级
        meta:{
          breadcrumb: '核赔管理'
        },
        children: [
          {
            path: '/assessmentApprovalList',
            component: () => import('@/views/assessmentApprovalList.vue'),
            meta:{
              breadcrumb: '核赔信息记录',
              title: '核赔信息记录'
            }
          },
          {
            path: '/assessmentApprovalAdd',
            component: () => import('@/views/assessmentApprovalAdd.vue'),
            meta:{
              breadcrumb: '新增核赔',
              title: '新增核赔'
            }
          },
        ]
      },
      {
        path: '/closure', //父层级
        meta:{
          breadcrumb: '结案管理'
        },
        children: [
          {
            path: '/closureTask',
            component: () => import('@/views/ClosureTask.vue'),
            meta:{
              breadcrumb: '待结案任务',
              title: '待结案任务'
            }
          },
          {
            path: '/closureAdd',
            component: () => import('@/views/ClosureAdd.vue'),
            meta:{
              breadcrumb: '结案处理',
              title: '结案处理'
            }
          },
          {
            path: '/closureList',
            component: () => import('@/views/ClosureList.vue'),
            meta:{
              breadcrumb: '结案信息',
              title: '结案信息'
            }
          },
        ]
      },
      {
        path: '/reject', //父层级
        meta:{
          breadcrumb: '拒赔管理'
        },
        children: [
          {
            path: '/rejectFrom',
            component: () => import('@/views/RejectFrom.vue'),
            meta:{
              breadcrumb: '拒赔申请',
              title: '拒赔申请'
            }
          },{
            path: '/rejectExamine',
            component: () => import('@/views/RejectionExamine.vue'),
            meta:{
              breadcrumb: '拒赔审核',
              title: '拒赔审核'
            }
          },
        ]
      },
      {
        path: '/preClaim', //父层级
        meta:{
          breadcrumb: '预赔管理'
        },
        children: [
          {
            path: '/addPreClaim',
            component: () => import('@/views/AddPreClaim.vue'),
            meta:{
              breadcrumb: '申请预赔',
              title: '申请预赔'
            }
          },
          {
            path: '/preClaimList',
            component: () => import('@/views/PreClaimList.vue'),
            meta:{
              breadcrumb: '审核预赔信息',
              title: '审核预赔信息'
            }
          },
        ]
      },
      {
        path: '/reopen', //父层级
        meta:{
          breadcrumb: '重开赔案管理'
        },
        children: [
          {
            path: '/addReopen',
            component: () => import('@/views/AddReopen.vue'),
            meta:{
              breadcrumb: '申请重开赔案',
              title: '申请重开赔案'
            }
          },
          {
            path: '/updateReopen',
            component: () => import('@/views/UpdateReopen.vue'),
            meta:{
              breadcrumb: '审核重开赔案信息',
              title: '审核重开赔案信息'
            }
          },
        ]
      },
      {
        path: '/role', //父层级
        meta:{
          breadcrumb: '权限管理'
        },
        children: [
          {
            path: '/userList',
            component: () => import('@/views/UserList.vue'),
            meta:{
              breadcrumb: '用户信息',
              title: '用户信息'
            }
          },
          {
            path: '/roleList',
            component: () => import('@/views/RoleList.vue'),
            meta:{
              breadcrumb: '角色信息',
              title: '角色信息'
            }
          },
          {
            path: '/menuList',
            component: () => import('@/views/MenuList.vue'),
            meta:{
              breadcrumb: '菜单信息',
              title: '菜单信息'
            }
          },
        ]
      },
      {
        path: '/pay', //父层级
        meta:{
          breadcrumb: '支付管理'
        },
        children: [
          {
            path: '/needPayList',
            component: () => import('@/views/NeedPayList.vue'),
            meta:{
              breadcrumb: '待付列表',
              title: '待付列表'
            }
          },
          {
            path: '/payResult',
            component: () => import('@/views/PayResult.vue'),
            meta:{
              breadcrumb: '支付完成',
              title: '支付完成'
            }
          },
          {
            path: '/payList',
            component: () => import('@/views/PayList.vue'),
            meta:{
              breadcrumb: '支付列表',
              title: '支付列表'
            }
          },
        ]
      },
      ],

  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
